package com.itheima.service.impl;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Random;

@Service
public class UserServiceImpl implements UserService {
    @Override
    public void save(User user) {
        try {
            // 模拟业务调用耗时
            Thread.sleep((int)(Math.random()*1000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("保存了用户数据~");
    }

    @Override
    public void update(User user) {

        System.out.println("更新了用户数据~");

    }

    @Override
    public void delete(String id) {

        System.out.println("删除了用户数据~");
    }

    @Override
    public List<User> findAll() {
        System.out.println("查询了用户数据~");
        try {
            // 模拟业务调用耗时
            Thread.sleep((int)(Math.random()*1000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return null;
    }
}
